import React, { PureComponent, Fragment } from 'react';
import { Table, Alert, Tabs, } from 'antd';
import styles from './index.less';



class TableComponent extends PureComponent {
  constructor(props) {
    super(props);
    const { columns } = props;
    this.state = {

    };
  }

  componentWillReceiveProps(nextProps) {

  }

  handleTableChange = (pagination, filters, sorter) => {
    const { onChange } = this.props;
    onChange(pagination, filters, sorter);
  };

  render() {
    const {
      data: { list, pagination },
      loading,
      columns,
      renderRowClass,
      scrolldis,
      expandedRowRender,
      rowKey
    } = this.props;

    const paginationProps = {
      showSizeChanger: true,
      showQuickJumper: true,
      ...pagination,
    };
    return (
      <div className={styles.standardTable}>
          <Table
            loading={loading}
            dataSource={list}
            columns={columns}
            pagination={paginationProps}
            onChange={this.handleTableChange}
            scroll={{ x: scrolldis || '100%'}}
            expandedRowRender = {expandedRowRender  || null}
            defaultExpandAllRows = {true}
            rowClassName={renderRowClass}
            rowKey={rowKey || 'key'}
          />
      </div>
    );
  }
}

export default TableComponent;
